package pe.com.upc.edu.rtt.detallepartido.controller;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.model.User;
import com.liferay.portal.service.UserLocalServiceUtil;

@Path("Usuarios")
public class UsuarioREST {
	//http://localhost:8090/ServicioRESTPortal-portlet/rest/Usuarios/uuid/bd7181c5-50e6-4ed6-91a9-7a7010cfd6f0
	@GET
	@Path("/uuid/{uuid}")
	@Produces(MediaType.APPLICATION_JSON)
	public String buscarUuid(@PathParam("uuid") String uuid) {
		try {
			User user = UserLocalServiceUtil.getUserByUuid(uuid);
			return user.getEmailAddress();
		} catch (PortalException e) {
			e.printStackTrace();
		} catch (SystemException e) {
			e.printStackTrace();
		}
		return "";
	}
	
}